﻿@model CommonFacetSettingsModel
@{
	var fieldPrefix = ViewData.TemplateInfo.HtmlFieldPrefix;
}

@if (fieldPrefix != "CategoryFacet")
{
	<table class="adminContent">
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.Disabled)
			</td>
			<td class="adminData">
				@Html.SettingEditorFor(model => model.Disabled)
				@Html.ValidationMessageFor(model => model.Disabled)
			</td>
		</tr>
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.DisplayOrder)
			</td>
			<td class="adminData">
				@Html.SettingEditorFor(model => model.DisplayOrder)
				@Html.ValidationMessageFor(model => model.DisplayOrder)
			</td>
		</tr>
		@if (fieldPrefix == "AvailabilityFacet")
		{
			<tr>
				<td class="adminTitle">
					@Html.SmartLabelFor(model => model.IncludeNotAvailable)
				</td>
				<td class="adminData">
					@Html.SettingEditorFor(model => model.IncludeNotAvailable)
					@Html.ValidationMessageFor(model => model.IncludeNotAvailable)
				</td>
			</tr>
		}
	</table>
}

@if (Model.Locales.Count == 1)
{
	<table class="adminContent">
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.Locales[0].Alias)
			</td>
			<td class="adminData">
				@Html.EditorFor(model => Model.Locales[0].Alias)
				@Html.ValidationMessageFor(model => model.Locales[0].Alias)
			</td>
		</tr>
		<tr>
			<td colspan="2">
				@Html.HiddenFor(model => model.Locales[0].LanguageId)
			</td>
		</tr>
	</table>
}
else
{
@(Html.LocalizedEditor<CommonFacetSettingsModel, CommonFacetSettingsLocalizedModel>(fieldPrefix + "-localized",
	@<table class="adminContent">
		<tr>
			<td class="adminTitle">
				@Html.SmartLabelFor(model => model.Locales[item].Alias)
			</td>
			<td class="adminData">
				@*IMPORTANT: Do not delete, this hidden element contains the id to assign localized values to the corresponding language *@
				@Html.HiddenFor(model => model.Locales[item].LanguageId)

				@Html.EditorFor(model => Model.Locales[item].Alias)
				@Html.ValidationMessageFor(model => model.Locales[item].Alias)
			</td>
		</tr>
	</table>
	, null))
}